<?php
/**
 * 优惠券服务层
 */
namespace app\service;
use think\Db;
class CouponService
{
	/**
	 * 优惠券类型
	 */
	public static $coupon_type_array = [
		0 => ['value' => 0, 'name' => '满减券'],
	];

	/**
	 * 优惠券发放场景
	 */
	public static $send_scene_array = [
		1 => ['value' => 1, 'name' => '新用户注册'],
		2 => ['value' => 2, 'name' => '手动发放'],
	];

	/**
	 * 用户优惠劵过期处理
	 */
	public static function CouponUserExpireHandle()
	{
		$map = [
			'is_use' => 0,
			'is_expire' => 0,
			'time_end' => ['LT', time()]
		];
		$count = Db::name('coupon_user')->where($map)->update(['is_expire' => 1, 'upd_time' => time()]);

	}
}